<template>
  <!--  用户行为路径-->
  <div class="attributionAnalysis">
    <div class="crumbs">
      <el-dialog
        class="el_dialog_class"
        :visible.sync="dialogVisibleForward"
        title="设置前向关联事件"
        width="910px"
        append-to-body
      >
        <ml-relation-event-forward
          :relationMain="targetEvent"
          :ref="`eventForward`"
        ></ml-relation-event-forward>
        <span slot="footer" class="dialog-footer">
          <el-button @click="dialogVisibleForward = false">取 消</el-button>
          <el-button type="primary" @click="dialogVisibleForward = false"
            >确 定</el-button
          >
        </span>
      </el-dialog>

      <el-dialog
        class="el_dialog_class"
        :visible.sync="dialogVisibleBackward"
        title="设置关联属性"
        width="910px"
        @open="backwardOpen"
        append-to-body
      >
        <ml-relation-event-backward
          :relationMain="targetEvent"
          :rightList="eventsToBeAttributed"
          :ref="`eventBackward`"
        ></ml-relation-event-backward>
        <span slot="footer" class="dialog-footer">
          <el-button @click="dialogVisibleBackward = false">取 消</el-button>
          <el-button type="primary" @click="dialogVisibleBackward = false"
            >确 定</el-button
          >
        </span>
      </el-dialog>

      <header class="crumbs_arr_box">
        <span>归因分析</span>
        <span class="tool_main">
          <!--                  <span class="save" @click="dialog_save=true">-->
          <!--                    <i class="el-icon-folder-add"></i>-->
          <!--                    保存-->
          <!--                  </span>-->
          <!--                  <i class="fgf"></i>-->
          <el-tooltip
            class="tool_son"
            effect="light"
            content="刷新"
            placement="bottom"
          >
            <i class="el-icon-refresh"></i>
          </el-tooltip>
          <el-tooltip
            class="tool_son"
            effect="light"
            content="下载数据"
            placement="bottom"
          >
            <i class="el-icon-download" @click="exportExcel"></i>
          </el-tooltip>
        </span>
      </header>
    </div>

    <!-- 筛选项区 start -->
    <div class="filterBox">
      <div class="viewFunnelBox">
        <!-- 初始事件 start -->
        <div class="step-wrap">
          <!--        序号+1-->
          <div class="lineHeader">选择事件</div>
        </div>
      </div>

      <div class="viewFunnelBox">
        <div class="step-wrap">
          <div class="lineHeader">目标转化事件</div>
          <el-tooltip
            class="item"
            effect="dark"
            content="一般为产品的支付、成单等收益相关的事件"
            placement="top"
          >
            <i class="el-icon-info"></i>
          </el-tooltip>
          <div style="position: absolute; height: 32px; left: 130px">
            <el-select
              size="small"
              v-model="targetEvent"
              value-key="eventId"
              @change="resetData()"
            >
              <el-option
                v-for="item in eventAll"
                :key="item.cname"
                :label="item.cname"
                :value="item"
              >
              </el-option>
            </el-select>
            <el-button
              type="text"
              icon="el-icon-full-screen"
              size="small"
              style="margin-left: 10px"
              @click="editCond(0)"
              >筛选</el-button
            >
            <el-button
              type="text"
              icon="el-icon-full-screen"
              size="small"
              style="margin-left: 10px"
              @click="dialogVisibleForward = true"
              >设置前项关联事件</el-button
            >
          </div>
        </div>
        <ml-custom-screen
          :ref="`customScreenRef0`"
          :isSupName="true"
          :supName="targetEvent.eventId"
        ></ml-custom-screen>

        <div class="step-wrap">
          <div class="lineHeader">待归因事件</div>
          <el-tooltip
            class="item"
            effect="dark"
            content="一般为广告的点击、运营位的点击等运营相关的事件"
            placement="top"
          >
            <i class="el-icon-info"></i>
          </el-tooltip>
          <div style="position: absolute; height: 32px; left: 130px">
            <el-select
              size="small"
              v-model="eventsToBeAttributed"
              value-key="eventId"
              filterable
              multiple
              collapse-tags
              @change="eventsToBeAttributedMethod"
            >
              <el-option
                v-for="item in eventAll"
                :key="item.cname"
                :label="item.cname"
                :value="item"
              >
              </el-option>
            </el-select>
            <el-button
              type="text"
              icon="el-icon-full-screen"
              size="small"
              style="margin-left: 10px"
              @click="editCond(1)"
              >筛选</el-button
            >
            <el-button
              type="text"
              icon="el-icon-full-screen"
              size="small"
              style="margin-left: 10px"
              @click="
                dialogVisibleBackward = true;
                componentDialog = 'ml-relation-event-backward';
              "
              >关联属性</el-button
            >
          </div>
        </div>
        <ml-custom-screen
          :ref="`customScreenRef1`"
          :isSupName="true"
          :supName="eventsToBeAttributedIds"
        ></ml-custom-screen>
      </div>

      <div class="viewFunnelBox">
        <div class="step-wrap">
          <div class="lineHeader">
            <div>按</div>
            <template v-for="(item, index) in readValues">
              <div :key="index">
                <ml-screen-button
                  icon="el-icon-full-screen"
                  size="small"
                  :orgin="index"
                  :showDelete="
                    index !== 0 || readValues[index].cname !== '总体'
                  "
                  @click="deleteScreentButton"
                >
                  {{ readValues[index].cname }}
                </ml-screen-button>
                <ml-category-filtering
                  v-if="readShow[index].isShow === true"
                  v-clickoutside="handleClickOutSide"
                  @selectItem="selectItem"
                  :origin="{ index: index }"
                  :dataShow="eventsToBeAttributed.length !== 0"
                  :tabsHeadParams="readHeads"
                  :tabsBodyParams="readBodys"
                ></ml-category-filtering>
              </div>
            </template>
            <el-button
              :style="{ marginLeft: '10px' }"
              type="text"
              icon="el-icon-plus"
              size="midden"
              @click="addReadList"
            >
            </el-button>
            <div style="font-size: small; margin-left: 10px">查看</div>
          </div>
        </div>
      </div>

      <div class="viewFunnelBox">
        <ml-custom-screen
          :ref="`customScreenRef2`"
          :isSupName="false"
          :isEvent="false"
        ></ml-custom-screen>
        <div class="step-wrap">
          <div class="lineHeader">
            <el-button
              type="text"
              icon="el-icon-full-screen"
              size="small"
              @click="editCond(2)"
              style="margin-left: 10px"
              >筛选条件
            </el-button>
          </div>
        </div>
      </div>

      <div class="viewFunnelBoxLast">
        <div class="step-wrap">
          <div class="lineHeader">分析模型</div>
          <el-select size="small" v-model="attributionTypeCur">
            <el-option
              v-for="item in attributionType"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>

          <span>归因窗口期</span>

          <el-select
            size="small"
            v-model="attributionWinowsCur"
            style="margin-left: 10px; width: 100px"
          >
            <el-option :key="0" label="自定义" :value="0"> </el-option>
            <el-option :key="1" label="当天" :value="1"> </el-option>
          </el-select>

          <template v-if="attributionWinowsCur === 0">
            <el-input
              placeholder="请输入内容"
              v-model="lookbackWindow.value"
              style="width: 300px"
              size="small"
            >
              <el-select
                v-model="lookbackWindow.unit"
                slot="append"
                placeholder="请选择"
                style="width: 80px"
              >
                <el-option label="分钟" value="minute"></el-option>
                <el-option label="小时" value="hour"></el-option>
                <el-option label="天" value="day"></el-option>
              </el-select>
            </el-input>
          </template>

          <div style="margin-left: 10px; position: absolute; right: 30px">
            <el-button
              :loading="loading"
              type="primary"
              icon="el-icon-search"
              size="small"
              style="width: 192px"
              @click="searchData"
              >分析计算
            </el-button>
          </div>
        </div>
      </div>
    </div>

    <div class="contentBox">
      <!-- 窗口期 -->
      <div class="winPeriodBox">
        <timeRestrict
          :oldTime="dateS"
          :timeRestrict="timeRestrict"
          @change="dateSChange"
        ></timeRestrict>

        <el-tooltip content="目标转化事件的发生时间" placement="top">
          <i class="el-icon-question" style="margin-left: 10px"></i>
        </el-tooltip>
      </div>
      <ml-table-funnel
        :attributeReportResData="attributeReportResData"
        :eventAll="eventAll"
        ref="exportExcel"
      ></ml-table-funnel>
    </div>
  </div>
</template>

<script>
//筛选控件
import customScreen from "./customScreen";
import CategoryFiltering from "./categoryFiltering";
/*  按xxx查看 */
import ScreenButton from "./screenButton";
/*  前置关联事件*/
import RelationEventForward from "./relationEventForward";
import RelationEventBackward from "./relationEventBackward";
import TimeSelect from "./timeSelect";
import TableFunnel from "./tableFunnel";

//当鼠标点击了指令所绑定元素的外部时，就会触发绑定方法所需要的控件
import clickoutside from "element-ui/src/utils/clickoutside";

//接口
import { thinglList, propertyList, attributionFunnel } from "./attribution";

import DataConfig from "./dataType.config";

export default {
  /*当点击控件外时 触发 element-ui自定义指令*/
  directives: { clickoutside },
  name: "index",
  components: {
    "ml-custom-screen": customScreen,
    "ml-time-select": TimeSelect,
    "ml-table-funnel": TableFunnel,
    "ml-screen-button": ScreenButton,
    "ml-category-filtering": CategoryFiltering,
    "ml-relation-event-forward": RelationEventForward,
    "ml-relation-event-backward": RelationEventBackward,
  },
  data() {
    return {
      //是否正在执行
      loading: false,
      //选择时间
      pickerOptions: [],
      //选择时间
      winPeriod: ["", ""],
      //归因类型
      attributionType: DataConfig.analysisModel,
      //当前选择的归因分析类型
      attributionTypeCur: "first",
      //归因窗口期
      attributionWinowsCur: 1,
      //开关启动的开关 目标转化事件
      dialogVisibleForward: false,
      //开关启动的开关 待归因事件
      dialogVisibleBackward: false,
      //当前dialog对应的控件名称
      componentDialog: "ml-relation-event-forward'",
      //所有事件
      eventAll: [],
      dateS: [], // 开始时间段
      //目标转化事件
      targetEvent: {},
      //待归因事件
      eventsToBeAttributed: [],
      eventsToBeAttributedIds: "",
      //选择事件属性列表
      eventPropertiesList: {},
      //选择用户属性列表
      userPropertiesList: {},
      //当前按XXX查看的数值
      readValues: [{ cname: "总体" }],
      //按XXX查看选择器的属性组
      readHeads: ["事件属性", "用户属性", "用户分群", "用户标签"],
      //是否展示按XXX查看选择器
      readShow: [{ isShow: false }],
      //属性分析结果
      attributeReportResData: {},
      lookbackWindow: { value: "", unit: "minute" },
      timeRestrict: {
        function: "absolute_time",
        params: [this.getBeforeDate(2), this.getBeforeDate()],
      }, // 动态时间参数
      startDate: this.getBeforeDate(2),
      endDate: this.getBeforeDate(),
    };
  },
  computed: {
    //按XXX查看选择器的属性值
    readBodys: function () {
      return [
        this.eventPropertiesList,
        this.userPropertiesList,
        {
          total: 1,
          list: [],
        },
        {
          total: 1,
          list: [],
        },
      ];
    },
  },
  mounted() {
    this.initData();
  },
  watch: {},
  methods: {
    //  追加对比 时间函数
    timeContrast(v) {
      let arr = [0, 0];
      // 同段时间
      if (v == "1") {
        let c = new Date(this.dateS[1]) - new Date(this.dateS[0]);
        arr[1] = new Date(this.dateS[0]) - 24 * 60 * 60 * 1000;
        arr[0] = arr[1] - c;
      }
      // 自定义时间
      if (v == "2") {
        arr[0] = new Date(this.dateS[0]) - 24 * 60 * 60 * 1000;
        arr[1] = new Date(this.dateS[1]) - 24 * 60 * 60 * 1000;
      }
      this.dateD = arr;
    },
    dateSChange(newValue) {
      let { sendTimeArr, timeRestrict } = newValue;
      this.timeRestrict = timeRestrict;
      this.dateS = [sendTimeArr[0], sendTimeArr[1]];
      this.startDate = sendTimeArr[0];
      this.endDate = sendTimeArr[1];
      let contrastStartDate = null;
      let contrastEndDate = null;
      if (this.dateD && this.dateD[0]) {
        let date = new Date(this.dateD[0]);
        let year = date.getFullYear();
        let mon = date.getMonth() + 1;
        let day = date.getDate();
        contrastStartDate = year + "-" + mon + "-" + day;
      }
      if (this.dateD && this.dateD[1]) {
        let date = new Date(this.dateD[1]);
        let year = date.getFullYear();
        let mon = date.getMonth() + 1;
        let day = date.getDate();
        contrastEndDate = year + "-" + mon + "-" + day;
      }

      // this.$emit("conversion", {
      //   unit: this.unit,
      //   startDate,
      //   endDate,
      //   contrastStartDate,
      //   contrastEndDate,
      //   timeRestrict    // 动态时间配置集合
      // });
    },
    exportExcel() {
      this.$refs.exportExcel.exportExcel();
    },
    backwardOpen() {
      if (this.$refs["eventBackward"]) {
        this.$refs["eventBackward"].loadList();
      }
    },
    //重新初始化两个控件
    resetData() {
      if (this.$refs["eventForward"]) {
        this.$refs["eventForward"].initData();
      }
      if (this.$refs["eventBackward"]) {
        this.$refs["eventBackward"].initData();
      }
    },
    //时间选择
    timeUnity(time) {
      this.winPeriod = time;
    },
    searchData() {
      let _this = this;
      let params = {};
      params["req"] = {};
      params["req"]["attributionEvents"] = this.getAttributionEvents();
      params["req"]["linkEvents"] = this.getLinkEvents();
      params["req"]["targetEvent"] = this.getTargetEvent();
      params["req"]["filter"] = this.getFilter();
      params["req"]["fromDate"] = this.startDate;
      params["req"]["toDate"] = this.endDate;
      params["req"]["lookbackWindow"] = this.getLookbackWindow();
      params["req"]["modelType"] = this.getModelType();
      console.log(params);
      this.loading = true;
      let _that = this;
      attributionFunnel(params)
        .then((res) => {
          _this.attributeReportResData = res.data.value.detailResult;
        })
        .finally(() => {
          _that.loading = false;
        });
    },
    getModelType() {
      return this.attributionTypeCur;
    },
    getLookbackWindow() {
      let lookbackWindow = {};
      if (this.attributionWinowsCur === 1) {
        lookbackWindow = { unit: "day", value: 0 };
      } else {
        lookbackWindow = {
          unit: this.lookbackWindow.unit,
          value: this.lookbackWindow.value,
        };
      }
      return lookbackWindow;
    },
    getFilter() {
      return this.$refs[`customScreenRef2`]?.getFilterConditions();
    },

    getTargetEvent() {
      let targetEvent = {};
      targetEvent["eventName"] = this.targetEvent.eventId;
      targetEvent["aggregator"] = "general";
      targetEvent["filter"] =
        this.$refs[`customScreenRef0`]?.getFilterConditions();
      return targetEvent;
    },

    getLinkEvents() {
      let linkEvents = [];
      if (this.$refs["eventForward"]?.getLinkEvents()) {
        linkEvents = this.$refs["eventForward"]?.getLinkEvents();
      }
      return linkEvents;
    },

    //获取计算请求参数 --- attributionEvents
    getAttributionEvents() {
      let attributionEvents = {};

      attributionEvents["byFields"] = [];
      for (let i = 0; i < this.readValues.length; i++) {
        if (this.readValues[i]?.name) {
          attributionEvents["byFields"].push(this.readValues[i]?.name);
        }
      }

      console.log(this.eventsToBeAttributed);
      console.log(this.targetEvent);

      attributionEvents["events"] = [];
      if (this.$refs["eventBackward"]?.getEvents()) {
        attributionEvents["events"] = this.$refs["eventBackward"]?.getEvents();
      } else {
        this.eventsToBeAttributed.forEach((value) => {
          let item = {};
          item["eventName"] = value["eventId"];
          item["eventName"] = value["eventId"];
          item["linkEvents"] = [];
          let linkItem = {};
          linkItem["eventName"] = this.targetEvent.eventId;
          linkItem["linkProperties"] = {};
          item["linkEvents"].push(linkItem);
          attributionEvents["events"].push(item);
        });
      }

      attributionEvents["filter"] =
        this.$refs[`customScreenRef1`]?.getFilterConditions();

      return attributionEvents;
    },
    getBeforeDate(number) {
      let num = number;
      let date = new Date();

      let year = date.getFullYear();
      let mon = date.getMonth() + 1;
      let day = date.getDate();

      if (typeof num === "number") {
        if (day <= num) {
          if (mon > 1) {
            mon = mon - 1;
          } else {
            year = year - 1;
            mon = 12;
          }
        }

        date.setDate(date.getDate() - num);

        year = date.getFullYear();
        mon = date.getMonth() + 1;
        day = date.getDate();
      }

      return (
        year +
        "-" +
        (mon < 10 ? "0" + mon : mon) +
        "-" +
        (day < 10 ? "0" + day : day)
      );
    },
    initData() {
      //获取属性列表
      //获取按 xxx 查看的列表
      //获取所有事件
      let network = new Promise(
        (resolve, reject) => {
          this.getEventPropertiesList(resolve, reject);
        },
        (error) => {
          this.$message.error(error);
        }
      );

      network
        .then(
          (value) => {
            return new Promise((resolve, reject) => {
              this.getUserPropertiesList(resolve, reject);
            });
          },
          (error) => {
            this.$message.error(error);
          }
        )
        .then(
          (value) => {
            return new Promise((resolve, reject) => {
              this.getEventList(resolve, reject);
            });
          },
          (error) => {
            this.$message.error(error);
          }
        )
        .then((value) => {});
    },

    editCond(index) {
      this.$refs[`customScreenRef${index}`].editCond();
    },

    getEventList(resolve, reject) {
      let _this = this;
      let params = {
        req: {
          appId: JSON.parse(window.sessionStorage.getItem("appItem")).appId,
        },
        operationCtx: {},
      };
      thinglList(params).then((res) => {
        // 返回状态码如果不是 200，说明数据异常，需弹窗提示
        if (res.data.success !== true) {
          t.$message.error(res.data.errorMessage);
          reject(res.data.errorMessage);
          return;
        }
        _this.eventAll = res.data.value.list;
        _this.targetEvent = res.data.value.list[0];
        resolve();
      });
    },

    getEventPropertiesList(resolve, reject) {
      let that = this;
      let params = {
        req: {
          events: ["_Anything"],
          type: "event",
          needEventTime: true,
        },
        operationCtx: {},
      };
      propertyList(params).then((res) => {
        // 返回状态码如果不是成功说明异常 弹出提示
        if (res.data.success !== true) {
          this.$message.error(res.data.errorMessage);
          reject(res.data.errorMessage);
          return;
        }
        that.eventPropertiesList = res.data.value;
        resolve();
      });
    },

    getUserPropertiesList(resolve, reject) {
      let that = this;
      let params = {
        req: {
          type: "user",
          needEventTime: true,
        },
        operationCtx: {},
      };
      propertyList(params).then((res) => {
        // 返回状态码如果不是成功说明异常 弹出提示
        if (res.data.success !== true) {
          this.$message.error(res.data.errorMessage);
          reject(res.data.errorMessage);
          return;
        }
        that.userPropertiesList = res.data.value;
        that.userPropertiesList.rows = res.data.value.list;
        resolve();
      });
    },

    //选择待归因事件
    eventsToBeAttributedMethod(val) {
      //初始化数据项
      let _this = this;
      let events = this.eventsToBeAttributed;
      let post = [];
      if (events.length === 0) {
        this.readValues = [{ cname: "总体" }];
        this.readShow = [{ isShow: false }];
        return;
      }
      //请求
      let attrs = "";
      for (let i = 0; i < events.length; i++) {
        attrs += events[i].eventId + ",";
      }
      if (attrs.length > 0) {
        attrs.substring(0, attrs.length - 1);
      }
      this.eventsToBeAttributedIds = attrs;

      //组装请求数据  -- 修改 待归因事件里面的属性数值
      for (let i = 0; i < events.length; i++) {
        if (events[i].propertes === undefined) {
          let params = {
            req: {
              events: [events[i].eventId],
              type: "event",
              needEventTime: true,
            },
            operationCtx: {},
          };
          propertyList(params).then((res) => {
            if (res.data.success !== true) {
              this.$message.error(res.data.errorMessage);
              return;
            }
            _this.eventsToBeAttributed[i].propertes = res.data.value.list;
          });
        }
      }

      //组装请求数据  -- 修改 按xx 查看的地方
      for (let i = 0; i < events.length; i++) {
        post.push(events[i].eventId);
      }
      let params = {
        req: {
          events: post,
          type: "event",
          needEventTime: true,
        },
        operationCtx: {},
      };

      propertyList(params).then((res) => {
        if (res.data.success !== true) {
          this.$message.error(res.data.errorMessage);
          return;
        }
        _this.eventPropertiesList = res.data.value;
      });
    },

    //按xxx查看的删除按钮
    deleteScreentButton(event, mes) {
      if (mes.isDelete === false || mes.isDelete === undefined) {
        this.readShow[mes.orgin].isShow = !this.readShow[mes.orgin].isShow;
      } else {
        this.readValues.splice(mes.orgin, 1);
      }
      this.$forceUpdate();
    },

    //点击外部时 关闭所有选择框
    handleClickOutSide(e) {
      // 当外部被点击时调用
      for (let i = 0; i < this.readShow.length; i++) {
        this.readShow[i].isShow = false;
      }
    },

    addReadList() {
      this.readValues.push({ cname: "总体" });
      this.readShow.push({ isShow: false });
    },
    /* 选择属性 */
    selectItem(mes, attribute, index) {
      this.readValues[mes.index] = attribute;
      this.$forceUpdate();
    },
  },
};
</script>

<style lang="scss" scoped>
.lineHeader {
  height: 36px;
  line-height: 36px;
  font-size: 14px;
  margin: 10px;
  display: flex;

  div {
    font-size: small;
    margin-left: 10px !important;
  }
}

* {
  touch-action: pan-y;
}

.timeBox {
  height: 32px;
  margin-right: 15px;
  margin-left: 15px;
  z-index: 100;
}

.step-wrap {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

::v-deep .show_hidden {
  visibility: hidden;
  position: absolute;
  left: 0;
  top: -0.2rem;
  z-index: 10;
}

.crumbs_arr_box {
  display: flex;
  justify-content: space-between;
  align-items: center;

  .tool_main {
    padding: 0 0.5rem 0 10px;
    font-size: 12px;
    font-weight: 500;
    color: #606266;
    // line-height: 44px;
    letter-spacing: 2px !important;

    .select {
      margin: 0 6px;
    }

    .fgf {
      display: inline-block;
      width: 1px;
      height: 16px;
      background: #c0c4cc;
      margin: 0 8px;
    }

    .tool_son {
      font-size: 16px;
      margin: 0 8px;
      font-size: 0.26rem;
    }

    .save {
      display: inline-block;
      font-size: 0.22rem;
      color: #007aff;
      height: 0.3rem;
      font-weight: 500;
      line-height: 0.3rem;
      margin-right: 0.1rem;

      i {
        font-size: 0.26rem;
      }
    }

    .tool_son:hover {
      color: #01b27a;
      font-weight: 600;
    }
  }
}

.block_tool {
  width: 98%;
  margin: 2px auto;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;

  .left {
    display: inline-block;
    width: 30%;
  }

  .right {
    display: inline-block;
    width: 70%;
  }

  .end {
    font-size: 14px;
    font-weight: 600;

    .btn_c {
      margin-right: 20px;
      font-weight: 400;
      font-size: 10px;
    }

    .btn_s {
      font-weight: 400;
      font-size: 10px;
      color: #f2f6fc;
      background: rgba($color: #01b27a, $alpha: 0.8);
      padding: 4px 10px;
      border-radius: 4px;
    }

    .btn_c:hover {
      color: #01b27a;
      font-weight: 500;
      font-size: 12px;
    }
  }
}

.attributionAnalysis::-webkit-scrollbar {
  display: none;
}

.attributionAnalysis {
  width: 98% !important;
  margin: 0 auto !important;
  box-sizing: border-box !important;
  height: 98.6% !important;
  overflow: scroll;
}

.filterBox,
.contentBox {
  padding: 10px 15px 10px 15px;
  /*padding:10px 15px;*/
  background-color: #ffffff;
  border-radius: 5px;
  margin: 15px 0;
  box-shadow: 0 2px 11px rgba(190, 202, 218, 0.17);
}

/* 筛选项区 */
.filterBox {
  .viewFunnelBox {
    border-bottom: 1px solid #e7e7e7;
    position: relative;

    .title-size {
      display: inline-block;
      width: 80px;
      padding: 0 10px;
      text-align: right;
    }

    .el-select {
      margin-right: 10px;
    }
  }

  .viewFunnelBoxLast {
    position: relative;

    .title-size {
      display: inline-block;
      width: 80px;
      padding: 0 10px;
      text-align: right;
    }

    .el-select {
      margin-right: 10px;
    }
  }

  .funnelSettingBox {
    border-left: 2px solid #6fd3b3;
    padding: 5px 0 5px 97px;
    position: relative;

    &:hover {
      background-color: #fafafa;
    }

    ::v-deep input[type="number"] {
      padding-right: 0;
    }

    .el-select {
      margin-right: 10px;
    }

    .size {
      padding-right: 5px;
    }

    .betweenBox,
    .datetimeBox {
      display: inline-block;
    }
  }

  i.el-icon-delete {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translate(0, -50%);
    cursor: pointer;

    &:hover {
      color: rgb(247, 86, 94);
    }
  }

  .andOrNotBox,
  .lineBox {
    position: absolute;
    top: 50%;
  }

  /* 且或非 */
  .andOrNotBox {
    width: 26px;
    height: 26px;
    font-size: 12px;
    text-align: center;
    line-height: 26px;
    border: 1px solid #cccccc;
    background-color: #fafafa;
    border-radius: 3px;
    cursor: pointer;
    z-index: 10;
    transform: translate(46px, -50%);
  }

  .lineBox {
    width: 26px;
    border: 1px solid #cccccc;
    border-right: none;
    transform: translate(60px, -50%);
    z-index: 5;
  }

  /* 设置筛选条件 */
  .settingCondition {
    padding: 10px 10px 0 100px;
  }
}

.childFilterBox {
  padding: 10px 0 15px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid #e7e7e7;
  overflow: hidden;

  .winPeriodBox {
    margin-left: 20px;
    float: left;

    .title {
      float: right;
      font-size: 12px;

      p {
        margin: -2px 0 -2px 10px;
      }

      p:nth-child(1) {
        color: #cccccc;
      }
    }
  }

  .el-radio-group {
    float: left;
  }

  .el-range-editor.el-input__inner {
    padding: 0 10px;
  }

  ::v-deep .el-range-editor--mini .el-range__close-icon {
    display: none;
  }

  ::v-deep .el-range-editor--mini .el-range-separator {
    line-height: 25px;
  }

  /* 对比选项 */
  .contrastFunnelBox {
    font-size: 12px;
    display: inline-block;
    padding: 0 10px;

    .vs {
      padding: 0 5px;
      font-size: 14px;
      font-weight: bold;
    }
  }
}

/* 营收事件步骤 */
.steps {
  padding: 6px 0px 6px;
  width: 100%;
  position: relative;
  height: auto;

  .step-wrap {
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  i {
    position: absolute;
    right: 10px;
    font-size: 14px;
    height: 5px;
  }
}
</style>

<style lang="scss" scoped>
::v-deep .el-button--success {
  width: 72px;
  height: 32px;
  font-size: 12px;
  padding: 5px;
}

::v-deep .el-radio-button__orig-radio:checked + .el-radio-button__inner {
  color: #fff;
  background-color: #67c23a;
  border-color: #67c23a;
}

::v-deep .el-divider--horizontal {
  width: 82%;
  margin-left: 20px;
}

::v-deep .el-input-number .el-input {
  width: 100px;
}
</style>
